﻿@using Digital.WCFClient.ConfigService
@using System.Collections.ObjectModel
@using Digital.Common.Mvc.Extensions
@using Digital.Web.Controllers
@using Microsoft.AspNet.Identity
@using Digital.Common.Utilities
@{
    ViewBag.Title = "企业播报列表";
    Layout = "~/Views/Shared/_LayoutDigital.cshtml";
}

@section PageSpecificJavascriptIncludes{
    <link rel="stylesheet" href="../DigitalStyle/css/jquery.gritter.css"/>

    <script src="../DigitalStyle/js/jquery.gritter.min.js"></script>
    <script src="../DigitalStyle/js/jquery.validate.min.js"></script>
    <script src="../DigitalStyle/js/JqueryToken.js"></script>
    <script src="../DigitalStyle/js/jquery.autogrow-textarea.js"></script>
    <script src="../DigitalStyle/js/messages_cn.js"></script>
}

<div class="pageheader">
    <h2><i class="fa fa-user"></i> 企业播报列表 <span>企业播报</span></h2>
    <div class="breadcrumb-wrapper">
        <span class="label">你的位置:</span>
        <ol class="breadcrumb">
            <li><a href="">企业中心</a></li>
            <li class="active">企业播报</li>
        </ol>
    </div>
</div>

<div class="contentpanel">
    <div class="row">

        <div class="btn-group mr10">
            <button class="btn btn-white" type="button" onclick="CheckAll()"><i class="fa fa-check mr5"></i>全选</button>
            @*<button class="btn btn-white" type="button"><i class="fa fa-minus-square mr5"></i> 取消</button>*@
        </div>

        <div class="btn-group mr10">
            <button class="btn btn-success" onclick="javascript: window.location = 'CompanyNewsAdd'" type="button"><i class="fa fa-pencil mr5"></i>发布播报</button>
            <button class="btn btn-danger" onclick="javascript:Deletes()" type="button"><i class="fa fa-trash-o mr5"></i>删除播报</button>
        </div>

        <div class="btn-group mr10">
            @*<button class="btn btn-warning" type="button"><i class="fa fa-external-link mr5"></i> 更改浏览权限</button>*@
            @*<button class="btn btn-white" type="button"><i class="fa fa-share mr5"></i> 移动</button>*@
        </div>

        @Html.AntiForgeryToken()
        <div class="table-responsive">
            <table class="table table-primary table-buglist">
                <thead>
                    <tr>
                        <th>排序</th>
                        <th>选择</th>
                        @*<th>权限</th>*@
                        <th>文章标题</th>
                        <th>所属分类</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        if (ViewBag.NewsList != null)
                        {
                            foreach (var NewsMode in (List<NewsModel>)ViewBag.NewsList)
                            {
                                <tr>
                                    <td>@NewsMode.NewsOrderID</td>
                                    <td><input type="checkbox" name="IdCheck" /></td>
                                    @*<td><a href="">所有人可浏览</a></td>*@
                                    <td><a href="">@NewsMode.NewsTitle</a></td>
                                    <td>@NewsMode.NewsCategoryModel.NewsCategoryName</td>
                                    <td>@NewsMode.ReleaseTime</td>
                                    <td>
                                        <div class="btn-group">
                                            <a data-toggle="dropdown" class="dropdown-toggle">
                                                <i class="fa fa-cog"></i>
                                            </a>
                                            <ul role="menu" class="dropdown-menu pull-right">
                                                <li><a href="CompanyNewsAdd?Id=@NewsMode.NewsID">编辑</a></li>
                                                <li><a href="javascript:Delete(@NewsMode.NewsID)">删除</a></li>

                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            }
                        }

                    }
                </tbody>
            </table>
        </div>

        @*<ul class="pagination pagination-split nomargin">
            <li class="disabled"><a href="#"><i class="fa fa-angle-left"></i></a></li>
            <li><a href="#">1</a></li>
            <li class="active"><a href="#">2</a></li>
            <li><a href="#">3</a></li>
            <li><a href="#">4</a></li>
            <li><a href="#">5</a></li>
            <li><a href="#"><i class="fa fa-angle-right"></i></a></li>
        </ul>*@

    </div>
</div>


<script>
    jQuery(document).ready(function () {

        // Delete row in a table
        jQuery('.delete-row').click(function () {
            var c = confirm("Continue delete?");
            if (c)
                jQuery(this).closest('tr').fadeOut(function () {
                    jQuery(this).remove();
                });

            return false;
        });

        // Show aciton upon row hover
        jQuery('.table-hidaction tbody tr').hover(function () {
            jQuery(this).find('.table-action-hide a').animate({ opacity: 1 });
        }, function () {
            jQuery(this).find('.table-action-hide a').animate({ opacity: 0 });
        });

        // Chosen Select
        jQuery(".chosen-select").chosen({
            'width': '100%',
            'white-space': 'nowrap',
            disable_search: true
        });

    });
    function callBack() {
        window.location = window.location;
    }

    function CheckAll() {
        $.jsparams.checkAll("IdCheck");
    }

    function Deletes() {
        var Ids = $.jsparams.checkByName("IdCheck");
        ComAjax("/Company/NewsDeletes", { Ids: Ids }, "新闻删除", "callBack");
    }

    function Delete(Id) {
        ComAjax("/Company/NewsDelete", { Id: Id }, "新闻删除", "callBack");
    }
</script>


